/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.util;

import br.com.deployment.entidade.selo.Selo;
import java.util.List;
import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author roniere
 */
public class SeloModel  extends ListDataModel<Selo> implements SelectableDataModel<Selo>{

    public SeloModel() {
    }

    
    public SeloModel(List<Selo> list) {
        super(list);
    }

    
    @Override
    public Object getRowKey(Selo t) {
         return t.getId();
    }

    @Override
    public Selo getRowData(String string) {
         List<Selo> sel = (List<Selo>) getWrappedData();  
          
        for(Selo sp : sel) {  
            if(sp.getId() == Integer.parseInt(string))  
                return sp;  
        }  
          
        return null; 
    }
    
}
